home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / samba / panic-action < prev    next >
Encoding:
Text File  |  2007-05-22  |  1.7 KB  |  55 lines

  1. #!/bin/sh
  2.  
  3. type mail >/dev/null 2>&1 || exit 0
  4.  
  5. # Redirect all output to our mail command
  6. (
  7.     # We must be given a pid to look at
  8.     if [ -z "$1" ]; then
  9.         echo "$0 called with no arguments."
  10.         exit 1
  11.     fi
  12.  
  13.     if [ ! -d "/proc/$1" ]; then
  14.         echo "$0: No such process: $1"
  15.         exit 1
  16.     fi
  17.  
  18.     # Find out what binary we're debugging
  19.     BINARYNAME=`readlink "/proc/$1/exe"`
  20.  
  21.     # Generic header for our email
  22.     echo "The Samba 'panic action' script, $0,"
  23.     echo "was called for PID $1 ($BINARYNAME)."
  24.     echo
  25.  
  26.     echo "This means there was a problem with the program, such as a segfault."
  27.  
  28.     if [ -z "$BINARYNAME" ]; then
  29.         echo "However, the executable could not be found for process $1."
  30.         echo "It may have died unexpectedly, or you may not have permission to debug"
  31.         echo "the process."
  32.         exit 1
  33.     fi
  34.  
  35.     # No debugger
  36.     if [ ! -x /usr/bin/gdb ]; then
  37.         echo "However, gdb was not found on your system, so the error could not be"
  38.         echo "debugged.  Please install the gdb package so that debugging information"
  39.         echo "is available the next time such a problem occurs."
  40.         exit 1
  41.     fi
  42.  
  43.     echo "Below is a backtrace for this process generated with gdb, which shows"
  44.     echo "the state of the program at the time the error occurred.  The Samba log"
  45.     echo "files may contain additional information about the problem."
  46.     echo 
  47.     echo "If the problem persists, you are encouraged to first install the "
  48.     echo "samba-dbg package, which contains the debugging symbols for the Samba "
  49.     echo "binaries. Then submit the provided information as a bug report to"
  50.     echo "Ubuntu. For information about the procedure for submitting bug reports,"
  51.     echo "please see http://www.ubuntulinux.org/support/bugs/document_view"
  52.     echo
  53.     gdb -x /etc/samba/gdbcommands -batch "$BINARYNAME" "$1"
  54. ) | mail -s "Panic or segfault in Samba" root
  55.